
import '../cache/Cache.dart';
import '../cache/SpUtil.dart';

mixin CacheMixin {
  SpUtil _sp = SpUtil.instance;
  Cache _cache = Cache.instance;

  Future<T> getSp<T>(String key, T def) {
    return _sp.getSp(key, def);
  }

  Future<bool> putSp<T>(String key, T def) {
    return _sp.putSp(key, def);
  }

  Future<bool> rmSp(String key) {
    return _sp.rmSp(key);
  }

  Future<bool> containsKey(String key) {
    return _sp.containsKey(key);
  }

  Future<bool> clear() {
    return _sp.clear();
  }

  P getCache<P>(String key, P def) => _cache.getCache(key, def);

  P popCache<P>(String key, P def) => _cache.popCache(key, def);

  void putCache<P>(String key, P obj) => _cache.putCache(key, obj);

  void rmCache(String key) => _cache.rmCache(key);
}
